var commonComponent = require("../common/component"), safeAreaMixin = require("../mixins/safe-area");

(0, commonComponent.VantComponent)({
    mixins: [ (0, safeAreaMixin.safeArea)() ],
    props: {
        show: Boolean,
        title: String,
        cancelText: String,
        zIndex: {
            type: Number,
            value: 100
        },
        actions: {
            type: Array,
            value: []
        },
        overlay: {
            type: Boolean,
            value: !0
        },
        closeOnClickOverlay: {
            type: Boolean,
            value: !0
        }
    },
    methods: {
        onSelect: function(event) {
            var index = event.currentTarget.dataset.index, action = this.data.actions[index];
            !action || action.disabled || action.loading || this.$emit("select", action);
        },
        onCancel: function() {
            this.$emit("cancel");
        },
        onClose: function() {
            this.$emit("close");
        }
    }
});